<template>
  <div class="wangji content">
    <div class="wangji-job">
      <span><</span>
      <router-link to="/xiugai"><div>忘记密码</div></router-link>
      <span class="dd"></span>
    </div>
    <div class="shuru">
      <div>+86<input v-model="phone" placeholder="请输入您的手机号" /></div>
    </div>
    <div class="yanzhengma">
      <div>
        <input v-model="phone1" type="text" placeholder="请输入您的验证码" />
      </div>
      <span @click="send">发送验证码</span>
    </div>
    <div>
      新密码<input v-model="phone2" type="text" placeholder="请输入您的新密码" />
    </div>
    <div @click="opo" class="btn content">确认提交</div>
  </div>
</template>
<style>
.content {
  width: 375px;
  margin: 0 auto;
}
.wangji-job {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  border-bottom: 1px solid #ccc;
}
.wangji-job div {
  color: rgb(9, 182, 116);
}
.dd {
  display: inline-block;
  width: 1px;
  height: 1px;
}
.shuru {
  padding: 20px;
  border-bottom: 1px solid #ccc;
}
.yanzhengma {
  display: flex;
  padding: 20px;
  border-bottom: 1px solid #ccc;
}
.yanzhengma span {
  background-color: rgb(9, 182, 116);
  height: 23px;
  line-height: 23px;
  margin: 0 5px;
  padding: 0 5px;
  color: #fff;
}
.btn {
  width: 300px;
  margin-top: 250px;
  text-align: center;
  background-color: rgb(9, 182, 116);
  border-radius: 25px;
  color: #fff;
  padding: 10px;
}
</style>
<script setup>
import { useRouter } from "vue-router";
import { ref } from "vue";
import axios from "axios";
const router = useRouter();
function mima() {
  router.push("/xiugai");
}

let phone = ref("");
let phone1 = ref("");
let phone2 = ref("");

function send() {
  axios
    .post(
      "https://fc-mp-827be4c1-176f-4e1f-985a-621b4417eadf.next.bspapp.com/api/user/pub/sendSmsCode",
      {
        checkUserExist: "!exists",
        type: "reset-pwd",
        mobile: phone.value,
      }
    )
    .then(function (response) {
      console.log(response);
    })
    .catch(function (error) {
      console.log(error);
    });
}
function opo() {
  axios
  .post(
    "https://fc-mp-827be4c1-176f-4e1f-985a-621b4417eadf.next.bspapp.com/api/user/pub/resetPasswordByMobile",{
      mobile: phone.value,
      code: phone1.value,
      password: phone2.value,
    }
  )
    .then((res)=> {
      console.log(res);
    })
}
</script>
